import { Component } from '@angular/core';
import { Menu } from './menu';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'ch0402';

  shouldShow = true;

  meniIndex=0;
  menus: Menu[]=[];

  constructor(){
    let menu=new Menu();
    menu.active=true;
    menu.name='111';
    this.menus.push(menu);

    menu=new Menu();
    menu.active=false;
    menu.name='222';
    this.menus.push(menu);

    menu=new Menu();
    menu.active=false;
    menu.name='333';
    this.menus.push(menu);
  }

  onMenuClicked(menu:Menu){
    for(let item of this.menus){
      item.active=false;
    }
    menu.active=true;
  }
  menuIndex=0;

  onToggle() {
    this.shouldShow = !this.shouldShow;
    return false;
  }
}
